/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Cong
 */
@Entity
@Table(name = "khachhang")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Khachhang.findAll", query = "SELECT k FROM Khachhang k"),
    @NamedQuery(name = "Khachhang.findById", query = "SELECT k FROM Khachhang k WHERE k.id = :id"),
    @NamedQuery(name = "Khachhang.findByTenkhachhang", query = "SELECT k FROM Khachhang k WHERE k.tenkhachhang = :tenkhachhang"),
    @NamedQuery(name = "Khachhang.findByDienthoai", query = "SELECT k FROM Khachhang k WHERE k.dienthoai = :dienthoai"),
    @NamedQuery(name = "Khachhang.findByEmail", query = "SELECT k FROM Khachhang k WHERE k.email = :email"),
    @NamedQuery(name = "Khachhang.findByDiachi", query = "SELECT k FROM Khachhang k WHERE k.diachi = :diachi"),
    @NamedQuery(name = "Khachhang.findByGioitinh", query = "SELECT k FROM Khachhang k WHERE k.gioitinh = :gioitinh"),
    @NamedQuery(name = "Khachhang.findByNgaysinh", query = "SELECT k FROM Khachhang k WHERE k.ngaysinh = :ngaysinh"),
    @NamedQuery(name = "Khachhang.findByNgaytaotaikhoan", query = "SELECT k FROM Khachhang k WHERE k.ngaytaotaikhoan = :ngaytaotaikhoan")})
public class Khachhang implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "tenkhachhang")
    private String tenkhachhang;
    @Column(name = "dienthoai")
    private String dienthoai;
    @Column(name = "email")
    private String email;
    @Column(name = "diachi")
    private String diachi;
    @Column(name = "gioitinh")
    private String gioitinh;
    @Column(name = "ngaysinh")
    @Temporal(TemporalType.TIMESTAMP)
    private Date ngaysinh;
    @Basic(optional = false)
    @Column(name = "ngaytaotaikhoan")
    @Temporal(TemporalType.TIMESTAMP)
    private Date ngaytaotaikhoan;
    @JoinColumn(name = "nguoitaotaikhoan", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Nhanvien nguoitaotaikhoan;

    public Khachhang() {
    }

    public Khachhang(Long id) {
        this.id = id;
    }

    public Khachhang(Long id, String tenkhachhang, Date ngaytaotaikhoan) {
        this.id = id;
        this.tenkhachhang = tenkhachhang;
        this.ngaytaotaikhoan = ngaytaotaikhoan;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTenkhachhang() {
        return tenkhachhang;
    }

    public void setTenkhachhang(String tenkhachhang) {
        this.tenkhachhang = tenkhachhang;
    }

    public String getDienthoai() {
        return dienthoai;
    }

    public void setDienthoai(String dienthoai) {
        this.dienthoai = dienthoai;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getDiachi() {
        return diachi;
    }

    public void setDiachi(String diachi) {
        this.diachi = diachi;
    }

    public String getGioitinh() {
        return gioitinh;
    }

    public void setGioitinh(String gioitinh) {
        this.gioitinh = gioitinh;
    }

    public Date getNgaysinh() {
        return ngaysinh;
    }

    public void setNgaysinh(Date ngaysinh) {
        this.ngaysinh = ngaysinh;
    }

    public Date getNgaytaotaikhoan() {
        return ngaytaotaikhoan;
    }

    public void setNgaytaotaikhoan(Date ngaytaotaikhoan) {
        this.ngaytaotaikhoan = ngaytaotaikhoan;
    }

    public Nhanvien getNguoitaotaikhoan() {
        return nguoitaotaikhoan;
    }

    public void setNguoitaotaikhoan(Nhanvien nguoitaotaikhoan) {
        this.nguoitaotaikhoan = nguoitaotaikhoan;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Khachhang)) {
            return false;
        }
        Khachhang other = (Khachhang) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gui.Khachhang[ id=" + id + " ]";
    }
    
}
